package model

import (
	"gopkg.in/mgo.v2/bson"
	"src/config"
)

func DayUpdateForumpostScore() {
	query := bson.M{
		"status": config.ForumPostCommonStatus,
	}
	forumposts, err := findForunpostsALL(query)
	if err != nil {
		return
	}
	for i := 0; i < len(forumposts); i++ {
		_ = UpdateForumpostScore(forumposts[i].ID.Hex(), -config.DayDepreciation)
	}
}

func DayUpdateCommentScore() {
	query := bson.M{
		"status": config.ForumPostCommonStatus,
	}
	comments, err := findCommentsALL(query)
	if err != nil {
		return
	}
	for i := 0; i < len(comments); i++ {
		_ = UpdateForumpostScore(comments[i].ID.Hex(), -config.DayDepreciation)
	}
}
